//
//  ViewController.m
//  5.9_ ZY
//
//  Created by bmli on 16/5/9.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"
#import "SimleSlide.h"
#import "SimalSeg.h"
#import "ViewRegster.h"

@interface ViewController ()

@property (nonatomic , retain) UISlider *SlideRed;
@property (nonatomic , retain) UISlider * SlideGreen;
@property (nonatomic , retain) UISlider * SlideBlue;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creatreSlide];
    [self createrSlide2];
    [self createSeg];
    [self creatSige];
  
}
#pragma mark - Slide
- (void)creatreSlide{
    SimleSlide * sliderRed = [[SimleSlide alloc]initWithFrame:CGRectMake(100, 120, 200, 50)];
    [self.view addSubview:sliderRed];
    [sliderRed release];
    
    sliderRed.minimumValue = 1;
    sliderRed.maximumValue = 100;
    [sliderRed addTarget:self action:@selector(handleSildeColor:) forControlEvents:UIControlEventValueChanged];
    
    SimleSlide * sliderGreen = [[SimleSlide alloc]initWithFrame:CGRectMake(100, 170, 200, 50)];
    [self.view addSubview:sliderGreen];
    [sliderGreen release];
   sliderGreen.minimumValue = 1;
   sliderGreen.maximumValue = 100;
    [ sliderGreen addTarget:self action:@selector(handleSildeColor:) forControlEvents:UIControlEventValueChanged];
    
    SimleSlide * sliderBlue = [[SimleSlide alloc]initWithFrame:CGRectMake(100, 220, 200, 50)];
    [self.view addSubview:sliderBlue];
    [sliderBlue release];
    sliderBlue.minimumValue = 1;
    sliderBlue.maximumValue = 100;
    [sliderBlue addTarget:self action:@selector(handleSildeColor:) forControlEvents:UIControlEventValueChanged];
}
- (void)handleSildeColor:(SimleSlide *)sliderColor{
     self.view.backgroundColor = [UIColor colorWithRed:arc4random() % 256 / 255.f green:arc4random() % 256 / 255.f blue:arc4random() % 256 / 255.f alpha:1];
    
  }

#pragma mark - Slide透明度

- (void)createrSlide2{
    
    SimleSlide * ClearSlide = [[SimleSlide alloc]initWithFrame:CGRectMake(100, 270, 100, 50)];
    [self.view addSubview: ClearSlide];
    [ClearSlide release];
    ClearSlide.minimumValue = 1;
    ClearSlide.maximumValue = 10;
    [ClearSlide addTarget:self action:@selector(handeleSildeClear:) forControlEvents:UIControlEventValueChanged];
    
}
- (void)handeleSildeClear:(SimleSlide * )clear{
    self.view.alpha =clear.value /10.0f;
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - 创建UISegmentControl

@end
